from celery.task import Task
from celery.registry import tasks

class ReservingNotification(Task):
    def run(self, msg, **kwargs):
        logger = self.get_logger(**kwargs)
        try:
            sent = msg.send()
            if sent:
                logger.info('Successfully sent email message to %r' % msg.to)
            else:
                logger.info('Failed to send email message to %r, retrying.' % msg.to)
        except:
            logger.error('Oops! something goes wrong.')

tasks.register(ReservingNotification)
